<template>
	<view class="warp">
		<view class="uni-margin-wrap">
			<view class="notice-list-body">
				<view class="uni-list">
					<block v-for="(value, index) in list" :key="index">
						<view class="uni-list-cell" hover-class="uni-list-cell-hover">
							<view class="uni-media-list">
								<image class="uni-media-list-logo" :src="value.logo ? value.logo : '/static/image/pic_errer.png'"></image>

								<view class="uni-media-list-body">
									<view class="uni-media-list-text-top">
										<text class="text">{{ value.logistics_name }}</text>
										<image class="image" :src="'/static/home/home_auth.png'"></image>
										<text class="text2">已认证</text>
									</view>
									<view class="uni-media-list-text-body">
										<view class="back-text">
											<block v-if="value.type == 1">
												<text>{{ value.receipt_site_name }} > {{ value.unload_site_name }}</text> 
											</block>
											<block v-else>
												<text>{{ value.receipt_site_name }} > {{ value.unload_site_name }} > {{ value.transfer}}</text> 
											</block>
											
										</view>
										
										<view class="btn" @click="toSend(value)">
											<text>一键发货</text>
										</view>
									</view>
									<view class="uni-media-list-text-bottom">
										<text class="text">线路：{{ value.type == 1 ? '直达' : '中转'}}</text>
									</view>
								</view>
							</view>
						</view>
					</block>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [],
			destination: '',
			origin: '',
		};
	},

	onLoad(option) {
		this.origin = option.fromArea;
		this.destination = option.toArea;
		this.getoLgisticsLineData();
	},
	methods: {
		toSend(e) {
			console.log(e);
			let obj = {
				line:e,
				type:'line'
			}  
			this.$util.redirectTo('/pages/tabBar/delivery/delivery', obj, 'reLaunch', 'obj');
		},
		getoLgisticsLineData() {
			var data = {
				origin: this.origin,
				destination: this.destination,
				type: ''
			};
			
			this.http.sendRequest({
				api: this.api.home.logisticsLineApi,
				data: data,
				success: res => {
					console.log(res);
					if (res.code == 1 && res.data) {
						this.list = res.data.data;
						console.log(this.list);
					}
				}
			});
		}
	}
};
</script>

<style lang="scss">
@import '../public/css/line-search.scss';
</style>
